package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.Roles;
import com.example.demo.service.RolesService;
import com.example.demo.mapper.RolesMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author GJC
* @description 针对表【roles】的数据库操作Service实现
* @createDate 2025-01-12 23:14:37
*/
@Service
public class RolesServiceImpl extends ServiceImpl<RolesMapper, Roles>
    implements RolesService{
    //获取用户角色列表
    public List<Roles> getList(){
        return this.baseMapper.selectList(new QueryWrapper<>());
    }
    //创建用户角色接口
    public int createRoles(Roles roles){
        return this.baseMapper.insert(roles);
    }
    //根据角色ID更新角色信息
    public int updateRoles(Roles roles){
        return this.baseMapper.updateById(roles);
    }
    //根据角色ID删除角色（需管理员权限）。
    public int delRoles(int id){
        return this.baseMapper.deleteById(id);
    }
}




